home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: newsfeed.acns.nwu.edu!ftpbox!mothost!mdisea!pilchuck!news
- From: Meiyu Lin <linm@data-io.com>
- Subject: Re: Is there a standard for * and & placement style?
- X-Nntp-Posting-Host: inet-gw
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <312E2E06.5582@data-io.com>
- Sender: news@data-io.com (Usenet news)
- Content-Transfer-Encoding: 7bit
- Organization: Data I/O Corp.
- References: <3128BD31.4AF8@wildfire.com> <4gfm7n$1an@news.voicenet.com>
- Mime-Version: 1.0
- Date: Fri, 23 Feb 1996 21:13:42 GMT
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Peter Kobak wrote:
- >
- > In message <marnoldDn27q9.Is0@netcom.com> - marnold@netcom.com (Matt Arnold)
- > writes:
- > :>
- > :>Stonewall Ballard <stoney@wildfire.com> writes:
- > :>
- > :>>I'm trying to find out whether there is a "standard" for the
- > :>>placement of * and &. A survey of C++ texts shows that most use
- > :>
- > :>>Form 1
- > :>> int& foo;
- > :>> int* foo;
- > :>
- > :>>while some use
- > :>
- > :>>Form 2
- > :>> int& foo;
- > :>> int *foo;
- > :>
- > :>There is probably no standard, just religiously held opinions.
- > :>
- >
- > After you settle this :-), how about where to put the 'const':
- >
- > A const& a;
- > A const &a;
- > const A& a;
- > const A &a;
- >
- > ================
- > Peter Kobak
- > kobak@voicenet.com
-
- const A *a // the pointer a is allowed to change
- A* const a // the pointer is to be declared as constant
- const A* const a // the pointer as well as the object pointed to as
- constant
-
- personally I preferred const A *a, *b, *c :-)
-
- Meiyu Lin
- linm@data-io.com
-